<?php

namespace app\admin\controller;
use app\admin\model\PaylogModel;
use app\common\controller\AdminBaseController;
use think\Db;
/**
 * 交易记录
 */
class PaylogController extends AdminBaseController
{
 	 protected $model;
	
    protected function _initialize() {
        parent::_initialize();
        $this->model = new PaylogModel();
    }
    /**
     * 交易记录列表
     * @author [lx] 
     */
    public function index(){
    	$map = [];
    	$field = 'g.*,m.id,m.mobile,m.nick_name,m.city';
		if(request()->isPost()){
		 	$param = input('post.');
			//用户名称
			if($param['name']){
				$map['m.nick_name'] = ['like', '%'.$param['name'].'%'];
			}
			//创建时间
			if($param['add_time']&&$param['end_time']){
				$map['g.add_time'] = ['between time', [$param['add_time'],$param['end_time']]];
			}
		}
		
		$list = Db::name("member")->alias('m')
		->join('mall_paylog g on','g.uid = m.id','LEFT')
		->field($field)->where($map)
		->order("g.add_time desc")->paginate(10);      
        return $this->fetch('index', ['list' => $list]);
    }	
}